<!DOCTYPE html>
<html>
<head>
<title>代码生成器</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="plugins/jqgrid/ui.jqgrid-bootstrap.css">
<link rel="stylesheet" href="css/main.css">
<script src="libs/jquery.min.js"></script>
<script src="plugins/layer/layer.js"></script>
<script src="libs/bootstrap.min.js"></script>
<script src="libs/vue.min.js"></script>
<script src="plugins/jqgrid/grid.locale-cn.js"></script>
<script src="plugins/jqgrid/jquery.jqGrid.min.js"></script>
<script src="js/common.js"></script>
</head>
<body>
<div id="rrapp">
	<div class="grid-btn">
		<div class="form-group col-sm-2">
			<input type="text" class="form-control" v-model="q.name" @keyup.enter="query" placeholder="数据源名称">
		</div>
		<a class="btn btn-default" @click="query">查询</a>

		<!-- 按钮触发模态框 -->
		<button class="btn btn-primary" data-toggle="modal" data-target="#addForm">添加</button>
		<!-- 模态框（Modal） -->
		<div class="modal fade" id="addForm" tabindex="-1" role="dialog" aria-labelledby="addFormLabel" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
						<h4 class="modal-title" id="addFormLabel">添加数据源</h4>
					</div>
					<div class="modal-body">
						<table class="table table-bordered">
							<tbody>
							<tr>
								<td class="col-sm-2">数据源名称</td>
								<td><input type="text" class="form-control" v-model="addForm.dataSourceName" placeholder="数据源名称"></td>
							</tr>
							<tr>
								<td>jdbc驱动类</td>
								<td><input type="text" class="form-control" v-model="addForm.driverClassName" readonly placeholder="com.mysql.jdbc.Driver"></td>
							</tr>
							<tr>
								<td>连接</td>
								<td><input type="text" class="form-control" v-model="addForm.url" placeholder="jdbc:mysql://localhost:3306"></td>
							</tr>
							<tr>
								<td>数据库名称</td>
								<td><input type="text" class="form-control" v-model="addForm.dbName" placeholder="数据库名称"></td>
							</tr>
							<tr>
								<td>用户名</td>
								<td><input type="text" class="form-control" v-model="addForm.userName" placeholder="用户名"></td>
							</tr>
							<tr>
								<td>密码</td>
								<td><input type="password" class="form-control" v-model="addForm.userPassword" placeholder="密码"></td>
							</tr>
							</tbody>
						</table>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
						<button type="button" class="btn btn-primary" @click="connectTestByInsert">连接测试</button>
						<button type="button" class="btn btn-primary" @click="insert">保存</button>
					</div>
				</div><!-- /.modal-content -->
			</div><!-- /.modal -->
		</div>

		<div class="modal fade" id="editForm" tabindex="-1" role="dialog" aria-labelledby="editFormLabel" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
						<h4 class="modal-title" id="editFormLabel">编辑数据源</h4>
					</div>
					<div class="modal-body">
						<table class="table table-bordered">
							<tbody>
							<tr>
								<td class="col-sm-2">数据源名称</td>
								<td><input type="text" class="form-control" v-model="editForm.dataSourceName" placeholder="数据源名称"></td>
							</tr>
							<tr>
								<td>jdbc驱动类</td>
								<td><input type="text" class="form-control" v-model="editForm.driverClassName" readonly placeholder="com.mysql.jdbc.Driver"></td>
							</tr>
							<tr>
								<td>连接</td>
								<td><input type="text" class="form-control" v-model="editForm.url" placeholder="jdbc:mysql://localhost:3306"></td>
							</tr>
							<tr>
								<td>数据库名称</td>
								<td><input type="text" class="form-control" v-model="editForm.dbName" placeholder="数据库名称"></td>
							</tr>
							<tr>
								<td>用户名</td>
								<td><input type="text" class="form-control" v-model="editForm.userName" placeholder="用户名"></td>
							</tr>
							<tr>
								<td>密码</td>
								<td><input type="password" class="form-control" v-model="editForm.userPassword" placeholder="密码"></td>
							</tr>
							</tbody>
						</table>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
						<button type="button" class="btn btn-primary" @click="connectTestByEdit">连接测试</button>
						<button type="button" class="btn btn-primary" @click="edit">保存</button>
					</div>
				</div><!-- /.modal-content -->
			</div><!-- /.modal -->
		</div>

	</div>
    <table id="jqGrid"></table>
    <div id="jqGridPager"></div>
</div>

<script src="js/datasource.js"></script>
</body>
</html>